package com.wang.user.service;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wang.user.mapper.UserMapper;
import com.wang.user.model.User;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
* @author wang3
* @description 针对表【user(用户主要信息)】的数据库操作Service实现
* @createDate 2024-11-10 23:54:14
*/
@Service("userServiceImpl")
public class UserServiceImpl extends ServiceImpl<UserMapper, User>
    implements UserService{

    @Resource
    private UserMapper userMapper;

    @Override
    public User Test(String userCode) {
        LambdaQueryWrapper<User> userLambdaQueryWrapper = new LambdaQueryWrapper<>();
        userLambdaQueryWrapper.eq(User::getUserCode,userCode);
        return userMapper.selectOne(userLambdaQueryWrapper);
    }

    /**
     * 根据saToken的loginId查询用户信息
     * @param loginId 登录保存的id
     * @return User
     */
    @Override
    public User getUserBySaLoginId(String loginId) {
        LambdaQueryWrapper<User> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(User::getId,loginId);
        return userMapper.selectOne(queryWrapper);
    }
}




